Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | 'use client'; import React from 'react'; import { cn } from '@/lib/utils'; interface SkeletonProps { className?: string; shimmer?: boolean; } export function Skeleton({ className, shimmer = true }: SkeletonProps) { return ( <div className={cn( 'bg-slate-800/50 rounded', shimmer && 'animate-pulse', className )} /> ); } // Card Skeleton export function CardSkeleton({ className }: { className?: string }) { return ( <div className={cn('bg-slate-800/30 rounded-lg p-4 space-y-3', className)}> <Skeleton className="h-4 w-3/4" /> <Skeleton className="h-3 w-1/2" /> <Skeleton className="h-20 w-full" /> </div> ); } // Table Row Skeleton export function TableRowSkeleton({ columns = 5 }: { columns?: number }) { return ( <div className="flex items-center gap-4 border-b border-slate-800 py-3"> {Array.from({ length: columns }).map((_, i) => ( <Skeleton key={i} className="h-4 flex-1" /> ))} </div> ); } // Table Skeleton export function TableSkeleton({ rows = 5, columns = 5 }: { rows?: number; columns?: number }) { return ( <div className="space-y-2"> {Array.from({ length: rows }).map((_, i) => ( <TableRowSkeleton key={i} columns={columns} /> ))} </div> ); } // Music Card Skeleton export function MusicCardSkeleton() { return ( <div className="bg-slate-800/30 rounded-lg p-3 space-y-2"> <Skeleton className="aspect-square w-full rounded-lg" /> <Skeleton className="h-4 w-3/4" /> <Skeleton className="h-3 w-1/2" /> <Skeleton className="h-3 w-2/3" /> </div> ); } // Content Card Skeleton (for movies, series, etc.) export function ContentCardSkeleton() { return ( <div className="bg-slate-800/30 rounded-lg overflow-hidden"> <Skeleton className="aspect-[2/3] w-full" /> <div className="p-3 space-y-2"> <Skeleton className="h-4 w-3/4" /> <Skeleton className="h-3 w-1/2" /> </div> </div> ); } // Grid Skeleton export function GridSkeleton({ items = 12, CardComponent = ContentCardSkeleton, className }: { items?: number; CardComponent?: React.ComponentType; className?: string; }) { return ( <div className={cn( 'grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-4', className )}> {Array.from({ length: items }).map((_, i) => ( <CardComponent key={i} /> ))} </div> ); } // List Item Skeleton export function ListItemSkeleton() { return ( <div className="flex items-center gap-3 p-3 bg-slate-800/30 rounded-lg"> <Skeleton className="h-12 w-12 rounded-lg flex-shrink-0" /> <div className="flex-1 space-y-2"> <Skeleton className="h-4 w-3/4" /> <Skeleton className="h-3 w-1/2" /> </div> <Skeleton className="h-8 w-20" /> </div> ); } // List Skeleton export function ListSkeleton({ items = 5 }: { items?: number }) { return ( <div className="space-y-2"> {Array.from({ length: items }).map((_, i) => ( <ListItemSkeleton key={i} /> ))} </div> ); } // Stats Card Skeleton export function StatsCardSkeleton() { return ( <div className="bg-slate-800/30 rounded-lg p-6 space-y-3"> <div className="flex items-center justify-between"> <Skeleton className="h-4 w-24" /> <Skeleton className="h-8 w-8 rounded-full" /> </div> <Skeleton className="h-8 w-20" /> <Skeleton className="h-3 w-32" /> </div> ); } // User Avatar Skeleton export function AvatarSkeleton({ size = 'md' }: { size?: 'sm' | 'md' | 'lg' }) { const sizeClasses = { sm: 'h-8 w-8', md: 'h-10 w-10', lg: 'h-16 w-16'}; return <Skeleton className={cn('rounded-full', sizeClasses[size])} />; } // Text Skeleton export function TextSkeleton({ lines = 3, className }: { lines?: number; className?: string; }) { return ( <div className={cn('space-y-2', className)}> {Array.from({ length: lines }).map((_, i) => ( <Skeleton key={i} className={cn( 'h-4', i === lines - 1 ? 'w-2/3' : 'w-full' )} /> ))} </div> ); } // Form Skeleton export function FormSkeleton({ fields = 4 }: { fields?: number }) { return ( <div className="space-y-4"> {Array.from({ length: fields }).map((_, i) => ( <div key={i} className="space-y-2"> <Skeleton className="h-4 w-24" /> <Skeleton className="h-10 w-full rounded-md" /> </div> ))} <div className="flex gap-2 justify-end pt-4"> <Skeleton className="h-10 w-24 rounded-md" /> <Skeleton className="h-10 w-24 rounded-md" /> </div> </div> ); } // Player Skeleton export function PlayerSkeleton() { return ( <div className="bg-slate-900/80 backdrop-blur-md rounded-lg p-4 space-y-3"> <div className="flex items-center gap-3"> <Skeleton className="h-12 w-12 rounded-lg" /> <div className="flex-1 space-y-2"> <Skeleton className="h-4 w-1/3" /> <Skeleton className="h-3 w-1/4" /> </div> </div> <Skeleton className="h-1 w-full" /> <div className="flex items-center justify-center gap-4"> <Skeleton className="h-8 w-8 rounded-full" /> <Skeleton className="h-10 w-10 rounded-full" /> <Skeleton className="h-8 w-8 rounded-full" /> </div> </div> ); } // Shimmer effect component (alternative to pulse) export function ShimmerSkeleton({ className }: { className?: string }) { return ( <div className={cn('relative overflow-hidden bg-slate-800/50 rounded', className)}> <div className="absolute inset-0 -translate-x-full animate-[shimmer_2s_infinite] bg-gradient-to-r from-transparent via-slate-700/50 to-transparent" /> </div> ); } // Add shimmer animation to global CSS or tailwind config: // @keyframes shimmer { // 100% { // transform: translateX(100%); // } // } |